# -*- mode: snippet -*-
# name: showtext template
# key: showtext.font.template
# key: font.showtext.template
# contributor: Shuguang Sun
# expand-env: ((yas-wrap-around-region t))
# --
require(showtext)
# sysfonts::font_paths(paste0(Sys.getenv("SCOOP"), "/persist/Fonts"))
# sysfonts::font_paths(paste0(Sys.getenv("USERPROFILE"),"/AppData/Local/Microsoft/Windows/Fonts"))
sysfonts::font_paths(`(concat "\"" (getenv "SCOOP") "/persist/Fonts\"")`)
sysfonts::font_paths(`(concat "\"" (getenv "USERPROFILE") "/AppData/Local/Microsoft/Windows/Fonts\"")`)
font.add(family = "Noto Sans CJK SC", regular = "NotoSansSC-regular.otf", bold = "NotoSansSC-bold.otf")
font.add(family = "Noto Serif CJK SC", regular = "NotoSerifSC-regular.otf", bold = "NotoSerifSC-bold.otf")
font_add(family = "heiti", regular = "simhei.ttf")
font_add(family = "kaiti", regular = "simkai.ttf")
font_add("Palatino", "pala.ttf")
showtext.auto() # necessary
$0

showtext::showtext_auto(FALSE)